<!DOCTYPE html>
<html>
<head>
    {include file="layout:_meta" /}
</head>
<body>
<div class="layui-fluid" style="padding-top: 20px">
    <div class="layui-card">
        <div class="layui-card-header">短信管理</div>
        <div class="layui-card-body">
            <form class="layui-form" lay-filter="layuiadmin-form-admin" action="{:url('config/sms')}">
                <div class="layui-tab layui-tab-brief" >
                    <ul class="layui-tab-title">
                        <li class="layui-this">短信管理</li>
                    </ul>
                    <div class="layui-tab-content" >
                        <div class="layui-tab-item layui-show">
                            <div class="layui-form-item">
                                <label class="layui-form-label" style="width: 120px">短信类型：</label>
                                <div class="layui-input-block"  style="margin-left: 150px">
                                    <input type="text" name="type" placeholder="请输入短信类型:text无模板、template模板" autocomplete="off" class="layui-input" value="{:isset($list.type)?$list.type:''}">
                                </div>
                            </div>
                            <div class="layui-form-item">
                                <label class="layui-form-label" style="width: 120px">是否测试：</label>
                                <div class="layui-input-block" style="margin-left: 150px">
                                    {if condition="!isset($list.isTest)||$list.isTest==true"}
                                    <input type="checkbox" lay-filter="isTest"  checked value="true" name="isTest" lay-skin="switch" lay-text="测试|真发">
                                    {else /}
                                    <input type="checkbox" lay-filter="isTest"  value="true" name="isTest" lay-skin="switch" lay-text="测试|真发">
                                    {/if}
                                </div>
                            </div>
                            <div class="layui-form-item">
                                <label class="layui-form-label" style="width: 120px">验证码长度：</label>
                                <div class="layui-input-block" style="margin-left: 150px">
                                    <input type="number" name="length" placeholder="请输入验证码长度" autocomplete="off" class="layui-input" value="{:isset($list.length)?$list.length:''}">
                                </div>
                            </div>
                            <div class="layui-form-item">
                                <label class="layui-form-label" style="width: 120px">服务商：</label>
                                <div class="layui-input-block" style="margin-left: 150px">
                                    <input type="text" name="smsSdk[class]" placeholder="请输入短信服务商class" autocomplete="off" class="layui-input" value="{:isset($list.smsSdk.class)?$list.smsSdk.class:''}">
                                </div>
                            </div>
                            <div class="layui-form-item">
                                <label class="layui-form-label" style="width: 120px">accessKeyId账号：</label>
                                <div class="layui-input-block" style="margin-left: 150px">
                                    <input type="text" name="smsSdk[account]" placeholder="请输入短信服务商account账号" autocomplete="off" class="layui-input" value="{:isset($list.smsSdk.account)?$list.smsSdk.account:''}">
                                </div>
                            </div>
                            <div class="layui-form-item">
                                <label class="layui-form-label" style="width: 120px">accessKeySecret密码：</label>
                                <div class="layui-input-block" style="margin-left: 150px">
                                    <input type="text" name="smsSdk[password]" placeholder="请输入短信服务商password账号" autocomplete="off" class="layui-input" value="{:isset($list.smsSdk.password)?$list.smsSdk.password:''}">
                                </div>
                            </div>
                            <div class="layui-form-item">
                                <label class="layui-form-label" style="width: 120px">短信签名：</label>
                                <div class="layui-input-block" style="margin-left: 150px">
                                    <input type="text" name="smsSdk[signature]" placeholder="请输入短信服务商短信签名" autocomplete="off" class="layui-input" value="{:isset($list.smsSdk.signature)?$list.smsSdk.signature:''}">
                                </div>
                            </div>
                            <div class="layui-form-item">
                                <label class="layui-form-label" style="width: 120px">注册短信模板id：</label>
                                <div class="layui-input-block" style="margin-left: 150px">
                                    <input type="text" name="smsScene[register][code]" placeholder="请输入忘记注册短信内容" autocomplete="off" class="layui-input" value="{:isset($list.smsScene.register.code)?$list.smsScene.register.code:''}">
                                </div>
                            </div>
                            <div class="layui-form-item">
                                <label class="layui-form-label" style="width: 120px">注册短信内容：</label>
                                <div class="layui-input-block" style="margin-left: 150px">
                                    <input type="text" name="smsScene[register][message]" placeholder="请输入忘记注册短信内容" autocomplete="off" class="layui-input" value="{:isset($list.smsScene.register.message)?$list.smsScene.register.message:''}">
                                </div>
                            </div>
                            <div class="layui-form-item">
                                <label class="layui-form-label" style="width: 120px">忘记密码模板id：</label>
                                <div class="layui-input-block" style="margin-left: 150px">
                                    <input type="text" name="smsScene[forget][code]" placeholder="请输入忘记密码短信内容" autocomplete="off" class="layui-input" value="{:isset($list.smsScene.forget.code)?$list.smsScene.forget.code:''}">
                                </div>
                            </div>
                            <div class="layui-form-item">
                                <label class="layui-form-label" style="width: 120px">忘记密码内容：</label>
                                <div class="layui-input-block" style="margin-left: 150px">
                                    <input type="text" name="smsScene[forget][message]" placeholder="请输入忘记密码短信内容" autocomplete="off" class="layui-input" value="{:isset($list.smsScene.forget.message)?$list.smsScene.forget.message:''}">
                                </div>
                            </div>
                            <div class="layui-form-item">
                                <div class="layui-input-block">
                                    <input type="hidden" name="smsModel" value="app\common\model\Sms">
                                    <button class="layui-btn" lay-submit lay-filter="submit">确认</button>
                                </div>
                            </div>
                        </div>
                    </div>
                </div>
            </form>
        </div>
    </div>
</div>

{include file="layout:_footer" /}
<script>
    var images = [];
    layui.config({
        base: '__static__/admin/' //静态资源所在路径
    }).extend({
        index: 'lib/index' //主入口模块
    }).use(['index', 'form', 'upload'], function(){
        var form = layui.form,$ = layui.$;

        form.on('switch(isTest)', function(data){
            this.value = this.checked?'true':'false';
        });

        //监听表单提交
        form.on('submit(submit)', function(data){
            layer.confirm('您确认要提交吗？', {
                btn: ['确认','取消'] //按钮
            }, function(index){
                $.post(data.form.action, data.field, function (res) {
                    var icon = 5;
                    if (res.code) {
                        icon = 6;
                    }
                    layer.msg(res.msg, {icon: icon, time: 1500});
                }, 'json');
            }, function(){
                layer.msg('已取消..');
                return false;
            });
            return false;
        });
    })
</script>
</body>
</html>